package com.food.eat.controller;

import com.demo.starter.controller.DemoController;
import com.demo.starter.service.DemoService;
import com.demo.starter.utils.ThreadpoolUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.ExecutorService;

/**
 * @Author RenPu
 * @Date 2021/11/25 16:28
 * @Version 1.0
 * @Description:  自定义starter的引入，以及项目的使用
 **/
@RestController
public class TestController {

   @Autowired
   private DemoService demoService;


   @RequestMapping("/test_starter/{id}")
    public String hellworld(@PathVariable String id){

       System.out.println(id);

       ExecutorService es = ThreadpoolUtils.getEs();
       es.execute(new Thread01());
       return  demoService.say();
    }

    static class Thread01 implements Runnable{

        @Override
        public void run() {
            System.out.println("自定义starter,调用工具类............");
        }
    }

}
